package fileIO;

import java.io.FileWriter;
import java.io.IOException;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;

public class XMLWriter {
	public static boolean writeDocument(Element root, String filePath){
		Document doc = new Document(root);
		
		try{
			XMLOutputter outputter = new XMLOutputter();
			FileWriter writer = new FileWriter(filePath);
			outputter.output(doc, writer);
			writer.flush();
			writer.close();
			return true;
		}catch(IOException e){
			//Cannot write
			return false;
		}
	}
}
